package com.lejin.usercenter.service.impl;


import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lejin.order.entity.OrderInfo;
import com.lejin.usercenter.mapper.OrderInfoMapper;
import com.lejin.usercenter.service.IOrderInfoService;
import com.lejin.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单信息表 服务实现类
 * </p>
 *
 * @author luminghua
 * @since 2022-04-22
 */
@Service
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements IOrderInfoService {



    @Autowired
    private OrderInfoMapper orderInfoMapper;

    @Override
    public ResultVO findOrderByUid(String userId) {
        if (StringUtils.isEmpty(userId)){



            return new ResultVO(false,"用户名不能为空");
        }
        List<OrderInfo> list = new LambdaQueryChainWrapper<OrderInfo>(orderInfoMapper).eq(OrderInfo::getUserId, userId).list();

        return new ResultVO(true,"success",list);
    }
}
